<?php
/**
 * Default view
 * Uses Smarty
 * 
 * @author paq
 *
 */
class View
{
	/**
	 * 
	 * @var View
	 */
	protected static $_instance;
	
	/**
	 * 
	 * @var Smarty
	 */
	protected $_Smarty;
	
	protected function __construct()
	{
		require_once('Smarty/Smarty.class.php');
		$this->_Smarty = new Smarty();
		$this->_Smarty->template_dir 	= 'templates';
		$this->_Smarty->compile_dir 	= 'templates_c';
		$this->_Smarty->config_dir 		= 'configs';
		$this->_Smarty->cache_dir 		= 'cache';
		$this->_Smarty->caching 		= false;
		$this->_Smarty->cache_lifetime 	= 30;
		
		Log::info('Smarty created');
	}
	
	/*public function __call($method, $vars)
	{
		return $this->_Smarty->$method($vars);
	}*/
	
	/*public function smarty()
	{
		return $this->_Smarty;
	}*/
	
	/**
	 * Returns Smarty instance
	 * 
	 * @return Smarty
	 */
	public static function get()
	{
		if (!isset(self::$_instance)) {
			self::$_instance = new View();
		}
		
		return self::$_instance->_Smarty;
	}
}